#! /usr/bin/perl

sub total {
	my $ret = 0;
	foreach (@_) {
		$ret += $_;
	}
	$ret;
}

my @fred = qw{ 1 3 5 7 9 };
my $fred_total = &total(@fred);
print "The total of \@fred is $fred_total.\n";
print "Enter some numbers on separate lines: ";
my $user_total = &total(<STDIN>);
print "The total of those numbers is $user_total.\n";

$total1000 = &total(1..1000);
print "the total of 1..1000 is $total1000.\n";